package ontology;

import ontology.actions.employmentlaw.GetCompleteInfo;
import ontology.actions.employmentlaw.GetUtilities;
import ontology.actions.employmentlaw.GetUtility;
import ontology.actions.employmentlaw.ReturnKnowledge;
import ontology.actions.general.AddNewResult;
import ontology.actions.general.AddNewTime;
import ontology.actions.general.GetCase;
import ontology.actions.general.GetCases;
import ontology.actions.general.GetKnowledge;
import ontology.actions.general.GetSimilarCases;
import ontology.actions.general.GetSimilarities;
import ontology.actions.general.Index;
import ontology.actions.general.InformCase;
import ontology.actions.general.Log;
import ontology.actions.general.ParseCases;
import ontology.actions.general.PreSelect;
import ontology.actions.general.ReturnCompleteInfo;
import ontology.actions.general.ReturnList;
import ontology.actions.general.ReturnParseCases;
import ontology.actions.general.ReturnSimilarities;
import ontology.actions.general.ReturnUtilities;
import ontology.actions.general.ReturnUtility;
import ontology.concepts.employmentlaw.Case;
import ontology.concepts.employmentlaw.Norm;
import ontology.concepts.employmentlaw.Outcome;
import ontology.concepts.general.DBQueryRules;
import ontology.concepts.general.Result;
import jade.content.onto.BasicOntology;
import jade.content.onto.Ontology;
import jade.content.onto.OntologyException;
import jade.content.schema.AgentActionSchema;
import jade.content.schema.ConceptSchema;
import jade.content.schema.ObjectSchema;
import jade.content.schema.PrimitiveSchema;

public class EmploymentLawOntology extends Ontology implements EmploymentLawVocabulary{
	
	// ----------> The name identifying this ontology
	public static final String ONTOLOGY_NAME = "UMCourtL-Ontology";

	// ----------> The singleton instance of this ontology
	private static Ontology instance = new EmploymentLawOntology();

	// ----------> Method to access the singleton ontology object
	public static Ontology getInstance() { return instance; }
	
	private EmploymentLawOntology()
	{
		super(ONTOLOGY_NAME, UMCourtLOntology.getInstance());
		
		try
		{
			/*
			 * 
			 * Create the several Schemas
			 * 
			 * */
			add(new ConceptSchema(NORM), Norm.class);
			add(new ConceptSchema(CASE), Case.class);
			add(new ConceptSchema(DBQUERYRULES), DBQueryRules.class);
			add(new ConceptSchema(RESULT), Result.class);
			add(new ConceptSchema(OUTCOME), Outcome.class);
			
			add(new AgentActionSchema(INDEX), Index.class);
			add(new AgentActionSchema(LOG), Log.class);
			add(new AgentActionSchema(GETCASE), GetCase.class);
			add(new AgentActionSchema(INFORMCASE), InformCase.class);
			add(new AgentActionSchema(PRESELECT), PreSelect.class);
			add(new AgentActionSchema(GETCASES), GetCases.class);
			add(new AgentActionSchema(PARSECASES), ParseCases.class);
			add(new AgentActionSchema(RETURNPARSECASES), ReturnParseCases.class);
			add(new AgentActionSchema(RETURNLIST), ReturnList.class);
			add(new AgentActionSchema(ADDNEWRESULT), AddNewResult.class);
			add(new AgentActionSchema(ADDNEWTIME), AddNewTime.class);
			add(new AgentActionSchema(GETSIMILARITIES), GetSimilarities.class);
			add(new AgentActionSchema(GETSIMILARCASES), GetSimilarCases.class);
			add(new AgentActionSchema(RETURNSIMILARITIES), ReturnSimilarities.class);
			add(new AgentActionSchema(GETUTILITIES), GetUtilities.class);
			add(new AgentActionSchema(RETURNUTILITIES), ReturnUtilities.class);
			add(new AgentActionSchema(GETCOMPLETEINFO), GetCompleteInfo.class);
			add(new AgentActionSchema(RETURNCOMPLETEINFO), ReturnCompleteInfo.class);
			add(new AgentActionSchema(GETKNOWLEDGE), GetKnowledge.class);
			add(new AgentActionSchema(RETURNKNOWLEDGE), ReturnKnowledge.class);
			add(new AgentActionSchema(GETUTILITY), GetUtility.class);
			add(new AgentActionSchema(RETURNUTILITY), ReturnUtility.class);
			
			/*
			 * 
			 * FILL THE SLOTS
			 * 
			 * 
			 * CONCEPTS
			 * 
			 * */
			
			//Norm
			ConceptSchema cs = (ConceptSchema) getSchema(NORM);
			cs.addSuperSchema((ConceptSchema)getSchema(ABSTRACTNORM));
			cs.add(NORM_ARTICLE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(NORM_ITEM, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(NORM_NUMBER, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(NORM_DESCRIPTION, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL);
			
			//Case
			cs = (ConceptSchema) getSchema(CASE);
			cs.addSuperSchema((ConceptSchema)getSchema(ABSTRACTCASE));
			cs.add(CASE_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(CASE_EMPLOYEE_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(CASE_EMPLOYER_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(CASE_EMPLOYEE_NORMS, (ConceptSchema) getSchema(NORM), 0, ObjectSchema.UNLIMITED);
			cs.add(CASE_EMPLOYER_NORMS, (ConceptSchema) getSchema(NORM), 0, ObjectSchema.UNLIMITED);
			cs.add(CASE_PARTY1WINS, (PrimitiveSchema) getSchema(BasicOntology.BOOLEAN), ObjectSchema.MANDATORY);
			
			//DBQueryRules
			cs = (ConceptSchema) getSchema(DBQUERYRULES);
			cs.add(DBQUERYRULES_DEPTH, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			
			//Result
			cs = (ConceptSchema) getSchema(RESULT);
			cs.add(RESULT_ACTION, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(RESULT_RESULT, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(RESULT_CODE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL);
			
			//Outcome
			cs = (ConceptSchema) getSchema(OUTCOME);
			cs.addSuperSchema((ConceptSchema)getSchema(ABSTRACTOUTCOME));
			cs.add(OUTCOME_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			cs.add(OUTCOME_DAYS_RECEIVED, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			cs.add(OUTCOME_NIGHT_WORK, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			cs.add(OUTCOME_SUPLEMENTARY_WORK, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			
			
			
	        /*
	         * 
	         * PREDICATES
	         * 
	         * */
	        
	        /*
	         * 
	         * AGENT ACTIONS
	         * 
	         * */
			AgentActionSchema as;
	        as = (AgentActionSchema) getSchema(INDEX);
	        as.add(INDEX_L, (ConceptSchema) getSchema(CASE), 1, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(LOG);
	        as.add(LOG_MESSAGE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        as.add(LOG_TIME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETCASE);
	        as.add(GETCASE_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(INFORMCASE);
	        as.add(INFORMCASE_CASE, (ConceptSchema) getSchema(CASE), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(PRESELECT);
	        as.add(PRESELECT_NEW_CASE, (ConceptSchema) getSchema(CASE), ObjectSchema.MANDATORY);
	        as.add(PRESELECT_METHOD, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETCASES);
	        as.add(GETCASES_R, (ConceptSchema) getSchema(DBQUERYRULES), ObjectSchema.MANDATORY);
	        as.add(GETCASES_C, (ConceptSchema) getSchema(CASE), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(PARSECASES);
	        as.add(PARSECASES_CASEIDS, (PrimitiveSchema) getSchema(BasicOntology.STRING), 0, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(RETURNLIST);
	        as.add(RETURNLIST_LIST, (ConceptSchema) getSchema(CASE), 0, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(RETURNPARSECASES);
	        as.add(RETURNPARSECASES_LIST, (ConceptSchema) getSchema(CASE), 0, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(ADDNEWRESULT);
	        as.add(ADDNEWRESULT_NEW_RESULT, (ConceptSchema) getSchema(RESULT), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(ADDNEWTIME);
	        as.add(ADDNEWTIME_TIME, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
	        as.add(ADDNEWTIME_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETSIMILARITIES);
	        as.add(GETSIMILARITIES_CASES, (ConceptSchema) getSchema(CASE), 1, ObjectSchema.UNLIMITED);
	        as.add(GETSIMILARITIES_NEW_C, (ConceptSchema) getSchema(CASE), ObjectSchema.MANDATORY);
	        as.add(GETSIMILARITIES_METHOD, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETSIMILARCASES);
	        as.add(GETSIMILARCASES_NEWCASE1, (ConceptSchema) getSchema(CASE), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(RETURNSIMILARITIES);
	        as.add(RETURNSIMILARITIES_CASE_LIST, (ConceptSchema) getSchema(CASE), 1, ObjectSchema.UNLIMITED);
	        as.add(RETURNSIMILARITIES_COMPARED_CASE, (ConceptSchema) getSchema(CASE), ObjectSchema.MANDATORY);
	        as.add(RETURNSIMILARITIES_SIMILARITIES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), 1, ObjectSchema.UNLIMITED);
	        

			as = (AgentActionSchema) getSchema(GETUTILITIES);
			as.add(GETUTILITIES_IDS, (PrimitiveSchema) getSchema(BasicOntology.STRING), 1, ObjectSchema.UNLIMITED);
			as.add(GETUTILITIES_HOUR_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITIES_DAY_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITIES_MONTH_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITIES_NIGHT_WORK, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITIES_SUPPLEMENTARY_WORK, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITIES_ANTIQUITY, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			
			as = (AgentActionSchema) getSchema(RETURNUTILITIES);
			as.add(RETURNUTILITIES_IDS, (PrimitiveSchema) getSchema(BasicOntology.STRING), 1, ObjectSchema.UNLIMITED);
			as.add(RETURNUTILITIES_UTILITIES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT),1, ObjectSchema.UNLIMITED);
			as.add(RETURNUTILITIES_OUTCOMES, (ConceptSchema) getSchema(OUTCOME), 1, ObjectSchema.UNLIMITED);
			
			as = (AgentActionSchema) getSchema(GETCOMPLETEINFO);
			as.add(GETCOMPLETEINFO_NEW_CASE1, (ConceptSchema) getSchema(CASE), ObjectSchema.MANDATORY);
			as.add(GETCOMPLETEINFO_HOUR_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETCOMPLETEINFO_DAY_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETCOMPLETEINFO_MONTH_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETCOMPLETEINFO_NIGHT_WORK, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETCOMPLETEINFO_SUPPLEMENTARY_WORK, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETCOMPLETEINFO_ANTIQUITY, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			
			as = (AgentActionSchema) getSchema(RETURNCOMPLETEINFO);
			as.add(RETURNCOMPLETEINFO_IDS, (PrimitiveSchema) getSchema(BasicOntology.STRING), 1, ObjectSchema.UNLIMITED);
			as.add(RETURNCOMPLETEINFO_UTILITES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT),1, ObjectSchema.UNLIMITED);
	        as.add(RETURNCOMPLETEINFO_SIMILARITIES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), 1, ObjectSchema.UNLIMITED);
	        as.add(RETURNCOMPLETEINFO_OUTCOMES, (ConceptSchema) getSchema(OUTCOME), 1, ObjectSchema.UNLIMITED);
	        

	        as = (AgentActionSchema) getSchema(GETKNOWLEDGE);
	        
	        as = (AgentActionSchema) getSchema(RETURNKNOWLEDGE);
	        as.add(RETURNKNOWLEDGE_BATNA, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
	        as.add(RETURNKNOWLEDGE_WATNA, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(RETURNKNOWLEDGE_GET_COMPLETE_INFO, (ConceptSchema) getSchema(GETCOMPLETEINFO), ObjectSchema.MANDATORY);
			as.add(RETURNKNOWLEDGE_RETURN_COMPLETE_INFO, (ConceptSchema) getSchema(RETURNCOMPLETEINFO), ObjectSchema.MANDATORY);
			
			as = (AgentActionSchema) getSchema(GETUTILITY);
	        as.add(GETUTILITY_HOUR_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
	        as.add(GETUTILITY_DAY_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITY_MONTH_WAGE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITY_ANTIQUITY, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(GETUTILITY_OUTCOME, (ConceptSchema) getSchema(OUTCOME), ObjectSchema.MANDATORY);
			
			as = (AgentActionSchema) getSchema(RETURNUTILITY);
	        as.add(RETURNUTILITY_UTILITY, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
		}
		catch(OntologyException oe)
		{
			oe.printStackTrace();
		}
	}
	
}
